home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 6
/
The Arsenal Files 6 (Arsenal Computer).ISO
/
prg_basi
/
n_b-v200.zip
/
NBT4
/
DMO
/
CLR_ALL.DMO
next >
Wrap
Text File
|
1996-03-11
|
11KB
|
181 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME CLR_ALL .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ ........................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
This demo has been constructed to put the DAS-NBT0.PBL into action. That
is the one where the mouse is turned OFF/ON when you call the TprintXXX
and TBoxXXX routines. As the clear screen subs all run through a series
of loops and make, in some cases, thousands of calls the mouse cursor
has a tendency to "flicker" just a bit, but it is all so fast that the
flicker looks better (if you can see it) than an explicit OFF/ON.
Selection "A" does this so you can see the difference and decide for
yourself how you want your programs to act. If you feel the mouse call
is better you can simply add MouseOFF and MouseON in each routine then
re-compile them or make the calls directly from your programs.
Just for demo purposes I've put the mouse to work with an Event. Don't
get too excited here as I didn't do a full menu for the keyboard so
things are a bit "strange" but it all works and shows some neat tricks
you can do using the DASoft libraries and some simple ASM code.
"No brag, just fact!"
Walter Brennon
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$STACK 2048
$STRING 8
$OPTIMIZE SIZE
$INCLUDE "DAS-NB01.INC"
$INCLUDE "DAS-NB02.INC"
$INCLUDE "DAS-NBT0.INC" ' the one with the mouse stuff
$INCLUDE "DAS-NBT1.INC"
$INCLUDE "DAS-NBT4.INC"
'───────────────────────────────────────────────┐
FileSpec$ = "DMO\DASLOGO.DAT" '│ CORRECT?
'───────────────────────────────────────────────┤
fMouseSetup 0 '│ get the mouse stuff ready
EventSetup 2, 30 '│ get the event handler ready
DIM E?(3,18) '│ our menu has 18 items
Row? = 15 : Col? = 7 '│
E?(0,0) = 16 : E?(1,0) = 7 '│ the array is from 0 -> 18
E?(2,0) = 25 : E?(3,0) = 74 '│ where E?(x,0) are the
FOR H% = 1 TO 18 '│ outside box parameters
IF (H% MOD 9) > 0 THEN '│
INCR Row?, 1 '│
ELSE '│
INCR Row?, 2 '│
END IF '│
IF H% = 10 THEN Col? = 43 : Row? = 16 '│
E?(0,H%) = Row? : E?(1,H%) = Col? '│
E?(2,H%) = Row? : E?(3,H%) = Col? + 31 '│
NEXT '│
fEventOpenT E?(0,0), 18 '│ open an event
'───────────────────────────────────────────────┤
'───────────────────────────────────────────────┤
FUNCTION fGetKey% () LOCAL PUBLIC '│ This is what fGetKey%
LOCAL G% '│ looks like when using
'│ fEventKey% the only
DO '│ difference is that it's
IF INSTAT THEN G%=CVI( INKEY$ + CHR$(0) ) '│ for kbrd and/or mouse
LOOP UNTIL ( G% > 0 ) OR _ '│
( fMouseGetKey% <> 0 ) '│ change this to > 0
FUNCTION = G% '│ if you only want
'│ clicks
END FUNCTION '│
'───────────────────────────────────────────────┤
'───────────────────────────────────────────────┤
SCREEN 0,,2,0 '│ use Apage 2
IF DIR$( FileSpec$ ) = "" THEN '│ just in case
TBoxFILL 1, 1, 25, 80, 177, 7 '│ fill Apage 2
ELSE '│
OPEN "B", #1, FileSpec$ '│ read in the data
GET$ #1, 4005, Scrn$ '│ that was stored
TBoxWrite Scrn$ '│ fTBoxREAD$ & write
CLOSE '│ to Apage 2
Scrn$ = "" '│ don't need this anymore
END IF '│
'───────────────────────────────────────────────┤
MouseONnow '│
SCREEN 0,,0,0 '│ working on Apage 0 now
Push? = 0 '│
Ltrs$ = "ABCDEFGHQIJKLMNOPZ" '│
G$ = "A" '│
DO '│
TBoxCopy 1, 1, 25, 80, 2, 0 '│ copy page 2 to page 0
Hit% = MAX( 1, INSTR( Ltrs$, G$ ) ) '│
EventClear '│ clear keyboard and mouse
DO '│
H% = ABS( Hit% ) '│
TBoxColorB E?(0,H%), E?(1,H%), 1, 32, 1 '│ just change the background
G% = fEventKey%( Hit%, "" ) '│ clear kbrd & wait for a key
TBoxColorB E?(0,H%), E?(1,H%), 1, 32, 0 '│ ditto.. change it back
LOOP UNTIL G% <> 0 OR Hit% > 0 '│
IF Hit% > 0 THEN '│
G$ = MID$("ABCDEFGHQIJKLMNOPZ", Hit%,1) '│
ELSEif ( G% > 0 ) AND ( G% < 255 ) THEN '│
G$ = UCASE$( CHR$(G%) ) '│
END IF '│
SELECT CASE G$ '│
CASE CHR$(027),"Q" : EXIT LOOP '│
CASE "Z" : IF Push? = 0 THEN '│ because we are storing the
Push? = 1 '│ menu screen on page 2 we
G$ = "ON " '│ have to write the change
ELSE '│ to that screen by 1st
Push? = 0 '│ setting the Apage to 2
G$ = "OFF" '│ then we go back to Apage 0
END IF '│ There really are easier
SCREEN 0,,2,0 '│ ways to do all of this but
Tprint 25, 56, G$, 0 '│ as a demo it shows how to
SCREEN 0,,0,0 '│ use the Apage with Tprint
ITERATE '│
CASE "A" '└────────┐
asm mov ax,&h02 ;│mouse off
asm int &h33 ;│ it doesn't get any
ClearTBoxBL 1,1,25,80,32,7 '│ cheaper than this!
asm mov ax,&h01 ;│ try it sometime
asm int &h33 ;│mouse on
CASE "B" : ClearTBoxBR 1, 1, 25, 80, 32, 7 '│
CASE "C" : ClearTBoxTL 1, 1, 25, 80, 32, 7 '│
CASE "D" : ClearTBoxTR 1, 1, 25, 80, 32, 7 '│
CASE "E" : ClearTBoxRND 1, 1, 25, 80, 32, 7 '│
CASE "F" : ClearTBoxVBH 1, 1, 25, 80, 32, 7 '│
CASE "G" : ClearTBoxVBV 1, 1, 25, 80, 32, 7 '│
CASE "H" : ClearTBoxZIO 1, 1, 25, 80, 32, 7 '│
CASE "I" : ClearTBoxDN 1, 1, 25, 80, 32, 7,Push? '│
CASE "J" : ClearTBoxHIO 1, 1, 25, 80, 32, 7,Push? '│
CASE "K" : ClearTBoxHOI 1, 1, 25, 80, 32, 7,Push? '│
CASE "L" : ClearTBoxLF 1, 1, 25, 80, 32, 7,Push? '│
CASE "M" : ClearTBoxRT 1, 1, 25, 80, 32, 7,Push? '│
CASE "N" : ClearTBoxUP 1, 1, 25, 80, 32, 7,Push? '│
CASE "O" : ClearTBoxVIO 1, 1, 25, 80, 32, 7,Push? '│
CASE "P" : ClearTBoxVOI 1, 1, 25, 80, 32, 7,Push? '│
CASE ELSE : CALL DemoHelp '│
ITERATE '│
END SELECT '│
DELAY 1 '│
LOOP '│
'│
EventClose '│ clean house
MouseOFF '│ Bye, Rodent!
CLS '│
END '│ END OF PROGRAM
'────────────────────────────────────────────────────────┘
SUB DemoHelp LOCAL PUBLIC
T$ = "There are 16 different ways to clear the" +_
"currently active page (Apage). Eight of" +_
"these have the extra feature of pushing" +_
"the area being cleared. These keys allow" +_
"you to see the different styles: " +_
" " +_
"<A> thru <P> for the 16 different styles" +_
"<Z> to turn ON/OFF the push feature " +_
"<Q> quit to DOS"
REPLACE "^" WITH CHR$(9) IN T$ ' use tabs to center text
SCREEN 0,,3,0 ' we'll use page 3 to
TBoxDraw 7, 19, 11, 44, 1, 47 ' draw & print our help
TprintTEXT 8, 21, 9, 40, T$, 0, 0, 0, 47 ' box then back to
SCREEN 0,,0,0 ' page 0
CopyTBoxVIO 7, 19, 11, 44, 3, 0 ' now copy the box
fAnyKey ' wait a key-press
CopyTBoxVOI 7, 19, 11, 44, 2, 0 ' restore original box
END SUB